widget: Don't add reordered children
authorMatthias Clasen <mclasen@redhat.com>
Sat, 24 Oct 2020 15:12:19 +0000 (11:12 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 24 Oct 2020 15:17:56 +0000 (11:17 -0400)
gtk_widget_reposition_after is called both to add new children,
and to reposition existing children. We only want to emit
accessible changes in the former case (since AT-SPI doesn't
have events for reordering).

gtk/gtkwidget.c

index 5d22f42248635e901f3e2f01d627e6854794d771..0e986f9d2310fdfb9c1b212b70c2005f9be74e1c 100644 (file)
@@ -5794,9 +5794,10 @@ gtk_widget_reposition_after (GtkWidget *widget,
       gtk_widget_queue_compute_expand (parent);
     }
 
-  gtk_accessible_update_children (GTK_ACCESSIBLE (parent),
-                                  GTK_ACCESSIBLE (widget),
-                                  GTK_ACCESSIBLE_CHILD_STATE_ADDED);
+  if (prev_parent == NULL)
+    gtk_accessible_update_children (GTK_ACCESSIBLE (parent),
+                                    GTK_ACCESSIBLE (widget),
+                                    GTK_ACCESSIBLE_CHILD_STATE_ADDED);
 
   gtk_widget_pop_verify_invariants (widget);
 }